

{{ include("common/header.html")}}

{{ include("common/column.html")}}


<div class="layui-container">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md8">
      <div class="fly-panel">
        <div class="fly-panel-title fly-filter">
          <a>置顶</a>
         <!-- <a href="#signin" class="layui-hide-sm layui-show-xs-block fly-right" id="LAY_goSignin" style="color: #FF5722;">去签到</a>-->
        </div>
        <ul class="fly-list">
          {% for data in topPostList %}
          <li>
            <a href="{{ G.url('app/users/home',{'uid':data.uid})}}" class="fly-avatar">
              <img src="{{_G['ATTACHMENT_ROOT']}}/{{data.avatar}}" alt="{{data.username}}">
            </a>
            <h2>
              <a class="layui-badge">{{data.cname}}</a>
              <a href="{{ G.url('app/detail/index',{'id':data.id})}}">{{data.title}}</a>
            </h2>
            <div class="fly-list-info">
              <a href="{{ G.url('app/users/home',{'uid':data.uid})}}" link>
                <cite>{{data.username}}</cite>
              <!--  <i class="iconfont icon-renzheng" title="认证信息：XXX"></i>
                <i class="layui-badge fly-badge-vip">VIP3</i>-->
              </a>
              <span class="time_str">{{data.change_time}}</span>

              <span class="layui-hide-xs" title="悬赏飞吻">  <i class="iconfont" title="人气"></i>&nbsp;&nbsp;{{data.visits_count}}</span>
              {% if data.status==1 %}
              <span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>
              {% endif %}
              <span class="fly-list-nums"> 
                <i class="iconfont icon-pinglun1" title="回答"></i>  {{data.reply_count}}
              </span>
            </div>
            <div class="fly-list-badge">
              {% if data.top==1 %}
              <span class="layui-badge layui-bg-black">置顶</span>
              {% endif %}
              {% if data.status==2 %}
               <span class="layui-badge layui-bg-red">精帖</span>
               {% endif %}

            </div>
          </li>
          {% endfor %}
          
        </ul>
      </div>

      <div class="fly-panel" style="margin-bottom: 0;">
        
        <div class="fly-panel-title fly-filter">
          
          <a href="{{ G.url('app/search/search',{'status':4})}}" class="layui-this" >综合</a>
          <span class="fly-mid"></span>

          <a href="{{ G.url('app/search/search',{'status':0})}}" >未结</a>
          <span class="fly-mid"></span>
          
          <a href="{{ G.url('app/search/search',{'status':1})}}" >已结</a>
          <span class="fly-mid"></span>
          
          <a href="{{ G.url('app/search/search',{'status':2})}}" >精华</a>
          <span class="fly-filter-right layui-hide-xs">
            

            <a href="{{ G.url('app/search/search',{'status':status,'orderBy':'create_time'})}}" {% if orderBy=='create_time' %} class="layui-this" {% endif %}>按最新</a>
            <span class="fly-mid"></span>
            <a href="{{ G.url('app/search/search',{'status':status,'orderBy':'reply_count'})}}" {% if orderBy=='reply_count' %} class="layui-this" {% endif %}>按热议</a>
          </span>
        </div>

        <ul class="fly-list"> 
          {% for data in comprehensivePostList %}         
          <li>
            <a href="{{ G.url('app/users/home',{'uid':data.uid})}}" class="fly-avatar">
              <img src="{{_G['ATTACHMENT_ROOT']}}/{{data.avatar}}" alt="{{data.username}}">
            </a>
            <h2>
              <a class="layui-badge">{{data.cname}}</a>
              <a href="{{ G.url('app/detail/index',{'id':data.id})}}">{{data.title}}</a>
            </h2>
            <div class="fly-list-info">
              <a href="{{ G.url('app/users/home',{'uid':data.uid})}}" link>
                <cite>{{data.username}}</cite>
                <!--
                <i class="iconfont icon-renzheng" title="认证信息：XXX"></i>
                <i class="layui-badge fly-badge-vip">VIP3</i>
                -->
              </a>
              <span class="time_str">{{data.change_time}}</span>

              <span class="layui-hide-xs" title="悬赏飞吻">  <i class="iconfont" title="人气"></i>&nbsp;&nbsp;{{data.visits_count}}</span>
              <!--<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>-->
              <span class="fly-list-nums"> 
                <i class="iconfont icon-pinglun1" title="回答"></i> {{data.reply_count}}
              </span>
            </div>
            <div class="fly-list-badge">
              <!--<span class="layui-badge layui-bg-red">精帖</span>-->
            </div>
          </li>
          {% endfor %}
        </ul>
        <div style="text-align: center">
          <div class="laypage-main">
            <a href="{{ G.url('app/search/search')}}" class="laypage-next">更多求解</a>
          </div>
        </div>

      </div>
    </div>
    <div class="layui-col-md4">

      <!--   <div class="fly-panel">
        <h3 class="fly-panel-title">温馨通道</h3>
        <ul class="fly-panel-main fly-list-static">
          <li>
            <a href="http://fly.layui.com/jie/4281/" target="_blank">layui 的 GitHub 及 Gitee (码云) 仓库，欢迎Star</a>
          </li>
          <li>
            <a href="http://fly.layui.com/jie/5366/" target="_blank">
              layui 常见问题的处理和实用干货集锦
            </a>
          </li>
          <li>
            <a href="http://fly.layui.com/jie/4281/" target="_blank">layui 的 GitHub 及 Gitee (码云) 仓库，欢迎Star</a>
          </li>
          <li>
            <a href="http://fly.layui.com/jie/5366/" target="_blank">
              layui 常见问题的处理和实用干货集锦
            </a>
          </li>
          <li>
            <a href="http://fly.layui.com/jie/4281/" target="_blank">layui 的 GitHub 及 Gitee (码云) 仓库，欢迎Star</a>
          </li>
        </ul>
      </div>


   <!--   <div class="fly-panel fly-signin">
        <div class="fly-panel-title">
          签到
          <i class="fly-mid"></i>
          <a href="javascript:;" class="fly-link" id="LAY_signinHelp">说明</a>
          <i class="fly-mid"></i>
          <a href="javascript:;" class="fly-link" id="LAY_signinTop">活跃榜<span class="layui-badge-dot"></span></a>
          <span class="fly-signin-days">已连续签到<cite>16</cite>天</span>
        </div>
        <div class="fly-panel-main fly-signin-main">
          <button class="layui-btn layui-btn-danger" id="LAY_signin">今日签到</button>
          <span>可获得<cite>5</cite>飞吻</span>

          <!-- 已签到状态 -->
          <!--
          <button class="layui-btn layui-btn-disabled">今日已签到</button>
          <span>获得了<cite>20</cite>飞吻</span>
          -->
      <!--      </div>
        </div>

        <!--     <div class="fly-panel fly-rank fly-rank-reply" id="LAY_replyRank">
              <h3 class="fly-panel-title">回贴周榜</h3>
              <dl>
                <!--<i class="layui-icon fly-loading">&#xe63d;</i>-->
      <!--    <dd>
           <a href="./index.php?m=app&c=users&a=home">
             <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"><cite>贤心</cite><i>106次回答</i>
           </a>
         </dd>
         <dd>
           <a href="./index.php?m=app&c=users&a=home">
             <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"><cite>贤心</cite><i>106次回答</i>
           </a>
         </dd>
         <dd>
           <a href="./index.php?m=app&c=users&a=home">
             <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"><cite>贤心</cite><i>106次回答</i>
           </a>
         </dd>
         <dd>
           <a href="./index.php?m=app&c=users&a=home">
             <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"><cite>贤心</cite><i>106次回答</i>
           </a>
         </dd>
         <dd>
           <a href="./index.php?m=app&c=users&a=home">
             <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"><cite>贤心</cite><i>106次回答</i>
           </a>
         </dd>
         <dd>
           <a href="./index.php?m=app&c=users&a=home">
             <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"><cite>贤心</cite><i>106次回答</i>
           </a>
         </dd>
         <dd>
           <a href="./index.php?m=app&c=users&a=home">
             <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"><cite>贤心</cite><i>106次回答</i>
           </a>
         </dd>
         <dd>
           <a href="./index.php?m=app&c=users&a=home">
             <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"><cite>贤心</cite><i>106次回答</i>
           </a>
         </dd>
         <dd>
           <a href="./index.php?m=app&c=users&a=home">
             <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"><cite>贤心</cite><i>106次回答</i>
           </a>
         </dd>
         <dd>
           <a href="./index.php?m=app&c=users&a=home">
             <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"><cite>贤心</cite><i>106次回答</i>
           </a>
         </dd>
         <dd>
           <a href="./index.php?m=app&c=users&a=home">
             <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"><cite>贤心</cite><i>106次回答</i>
           </a>
         </dd>
         <dd>
           <a href="./index.php?m=app&c=users&a=home">
             <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"><cite>贤心</cite><i>106次回答</i>
           </a>
         </dd>
       </dl>
     </div>-->

    <dl class="fly-panel fly-list-one">
        <dt class="fly-panel-title">一周热议</dt>
        {% for data in hotPostList %} 
        <dd>
          <a href="{{ G.url('app/detail/index',{'id':data.id})}}">{{data.title}}</a>
          <span><i class="iconfont icon-pinglun1"></i> {{data.reply_count}}</span>
        </dd>
        {% endfor %}
        

        <!-- 无数据时 -->
        <!--
        <div class="fly-none">没有相关数据</div>
        -->
      </dl>

      <div class="fly-panel">
        <div class="fly-panel-title">
          首页广告
        </div>
        {% for data in firstList %}
          {% if data.type==1 %}
          <div class="fly-panel-main">
            <a href="{{data.url_path}}" target="_blank" class="fly-zanzhu" time-limit="2017.09.25-2099.01.01" style="background-color: #5FB878;">{{data.name}}</a>
          </div>
          {% else %}
            <div class="fly-panel-main">
              <a href="{{data.url_path}}" target="_blank" time-limit="2017.09.25-2099.01.01" >
              <img src="{{_G['ATTACHMENT_ROOT']}}/{{data.image}}" style="width:350px;height:60px;" alt=""/>
              </a>
            </div>
           {% endif %}
        {% endfor %}

      </div>
      
      <div class="fly-panel fly-link">
        <h3 class="fly-panel-title">友情链接</h3>
        <dl class="fly-panel-main">
          {% for data in link %}
          <dd><a href="{{data.url_path}}" target="_blank">{{data.name}}</a><dd>
          {% endfor %}

          <dd><a href="mailto:xianxin@layui-inc.com?subject=%E7%94%B3%E8%AF%B7Fly%E7%A4%BE%E5%8C%BA%E5%8F%8B%E9%93%BE" class="fly-link">申请友链</a><dd>
        </dl>
      </div>

    </div>
  </div>
</div>
<script>  
  layui.use(['util','jquery'], function(){
    var util = layui.util;   
    var $ = layui.$ //由于layer弹层依赖jQuery，所以可以直接得到
    var setTimeAgo = function(y, M, d, H, m, s){
      var str = util.timeAgo(new Date(y, M||0, d||1, H||0, m||0, s||0));
      return str
    };
    $(function(){
      $(".time_str").each(function(){
        var timestamp=$(this).text()
        //console.log($(this).text())
        var date = new Date();
        date.setTime(timestamp * 1000);
        var year  = date.getFullYear(); 
        var month  = date.getMonth(); 
        var day   = date.getDate(); 
        var hour  = date.getHours(); 
        var minute = date.getMinutes(); 
        var second = date.getSeconds(); 
        var str=setTimeAgo(year,month,day,hour,minute,second);
        console.log(str)
        $(this).html(str)
      });
    })
  });
</script>
{{ include("common/footer.html")}}



